<me:UIBGA x:Class="WPFExcelReport.TSBS08"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                      xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:TXT="clr-namespace:WPFExcelReport;assembly=TTXTIND"  
                    xmlns:GC="clr-namespace:WPFExcelReport;assembly=TGSCOLOR" 
                    x:Name="TV"
                    FTAUTOSUM="True"
                     SKEY1="BAGART" 
                     KEY1="BAGKGBRUT"     
                    Loaded="Window_Loaded"
     >
    <me:UIBGA.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIBGA.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" >
            <WrapPanel IsEnabled="{Binding IsEdit,ElementName=TV}"   >
                <Button  Click="NewCommand" Width="24" Height="20"
                             >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                    </Button.Background>
                </Button>
                <Button  Click="DeleteCommand" Width="24" Height="20" Margin="10,0,0,0"
                             >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button> 
                <WrapPanel Visibility="{Binding IsFromWT,ElementName=TV,Converter={StaticResource bv}}">
                    <Button   Click="RefreshCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsEdit,ElementName=TV}"  >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Refresh.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=从花型更新}}"/>
                                   
                </WrapPanel>
                <WrapPanel Visibility="Collapsed">
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=纱}}"/>
                    <TextBlock Text="{Binding BAGGART}"    Width="100"/>
                    <TextBlock  Visibility="Collapsed" Text="{Binding Source={Localization:Translate Word=var}}"/>
                    <TextBlock Text="{Binding BAGGVAR}"  Visibility="Collapsed"  Width="40"/>
                    <TextBlock  Visibility="Collapsed" Text="{Binding Source={Localization:Translate Word=色号}}"/>
                    <TextBlock Visibility="Collapsed" Text="{Binding BAGGFARBE}"  Width="60"/>
                </WrapPanel>
            </WrapPanel>
            <StackPanel>
                <WrapPanel>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=选择经线规格}}"/> 
                    <GC:TSGS07  KEY="{Binding YARN,ElementName=TV}" 
                            IsEdit="{Binding IsEdit,ElementName=TV}" 
                            />
                    <TextBlock  Margin="5,0,0,0" Text="{Binding Source={Localization:Translate Word=行}}"/>
                    <TextBlock  Text="{Binding BAGPOS}" Width="40"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=根数}}"/>
                    <ex:NumericBox DecimalPlaces="0" Maximum="99999" Text="{Binding BAGFDZ}" Width="80"
                       IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=损耗%}}"/>
                    <ex:NumericBox DecimalPlaces="1"  Text="{Binding BAGABF,Converter={StaticResource d10}}"  Width="40"/>
                </WrapPanel>
            </StackPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   IsReadOnly="True"
                   x:Name="dlgMaster" 
                   RowDetailsVisibilityMode="Visible"  
                >
            <DataGrid.Columns> 
                <DataGridTextColumn Binding="{Binding Path=BAGPOS, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=行}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGGART, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=纱}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGGVAR, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=var}}"  Width="Auto"  Visibility="Collapsed"/>
                <DataGridTextColumn Binding="{Binding Path=BAGGFARBE, Converter={StaticResource gb2312}}"   Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGFDZ, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=根数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGABF, Converter={StaticResource d10}}" Header="{Binding Source={Localization:Translate Word=损耗}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGKGNET,Converter={StaticResource d1000}}" Header="{Binding Source={Localization:Translate Word=净重}}"  Visibility="Collapsed" Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGKGBRUT,Converter={StaticResource d1000}}" Header="{Binding Source={Localization:Translate Word=用量}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGDISPOKZ}" Header="{Binding Source={Localization:Translate Word=受控}}"  Width="Auto"  Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=BAGBEM}" Header="{Binding Source={Localization:Translate Word=备注}}"  Width="Auto"  Visibility="Collapsed" />
                <DataGridTextColumn Binding="{Binding Path=BAGAUFMSL}" Header="{Binding Source={Localization:Translate Word=包装}}"  Width="Auto"  Visibility="Collapsed"/>
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>

</me:UIBGA>

    
